from django.contrib.auth.models import Permission, ContentType
from .permission_serializers import PermissionSerializer, ContentTypeSerializer
from rest_framework.generics import ListAPIView, CreateAPIView
from meiduo_admin.my_paginations import MyPageNumberPagination
from rest_framework.viewsets import ModelViewSet


class PermissionViewSet(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = PermissionSerializer
    queryset = Permission.objects.order_by('id').all()


class ContenTypeView(ListAPIView):
    serializer_class = ContentTypeSerializer
    queryset = ContentType.objects.order_by('id').all()
